package com.ld.security.auth.server.modules.sys.rpc;

import com.ld.security.auth.server.modules.sys.entity.SysPermission;
import com.ld.security.auth.server.modules.sys.service.ISysPermissionService;
import com.ld.security.common.core.base.po.EntitysPo;
import com.ld.security.common.core.base.rpc.SuperRpc;
import com.ld.security.common.core.base.vo.DataVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

@RestController
@Api(tags="树管理")
@RequestMapping("/rpc/sysTree")
public class TreeRpc extends SuperRpc {

    @Autowired
    private ISysPermissionService iSysPermissionService;



    @RequestMapping(value="/initPermission",method = RequestMethod.POST)
    @ApiOperation("初始化权限树")
    public DataVo initPermission(@RequestBody EntitysPo<SysPermission> po){
        iSysPermissionService.initTree(po.getList());
        DataVo vo =  DataVo.of();
        vo.setMessage("初始化权限树成功");
        return vo;
    }


}
